package com.zb.service.impl;

import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zb.entity.ZjWorkFeeDetailImage;
import com.zb.mapper.ZjWorkFeeDetailImageMapper;
import com.zb.service.ZjWorkFeeDetailImageService;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * 工单费用信息图片表 服务实现类
 * </p>
 *
 * @author WEN
 * @since 2023-10-25
 */
@Service
public class ZjWorkFeeDetailImageServiceImpl extends ServiceImpl<ZjWorkFeeDetailImageMapper, ZjWorkFeeDetailImage> implements ZjWorkFeeDetailImageService {

    // 根据工单费用信息表ID删除
    @Override
    public void deleteByWorkFeeDetailId(List<Long> workFeeDetailIds) {
        if (CollectionUtil.isEmpty(workFeeDetailIds)) {
            return;
        }
        QueryWrapper<ZjWorkFeeDetailImage> wrapper = new QueryWrapper<>();
        wrapper.in("work_fee_detail_id", workFeeDetailIds);
        this.remove(wrapper);
    }

    // 根据工单费用信息表ID获取信息
    @Override
    public List<ZjWorkFeeDetailImage> getByWorkFeeDetailIds(List<Long> workFeeDetailIds) {
        if (CollectionUtil.isEmpty(workFeeDetailIds)) {
            return new ArrayList<>();
        }
        QueryWrapper<ZjWorkFeeDetailImage> wrapper = new QueryWrapper<>();
        wrapper.in("work_fee_detail_id", workFeeDetailIds);
        return this.list(wrapper);
    }
}
